import 'package:flutter_test/flutter_test.dart';
import 'package:lib_music/lib_music.dart';
import 'package:lib_music/lib_music_platform_interface.dart';
import 'package:lib_music/lib_music_method_channel.dart';
import 'package:lib_music/listener/OnFftDataListener.dart';
import 'package:lib_music/listener/OnMusicCallback.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockLibMusicPlatform
    with MockPlatformInterfaceMixin
    implements LibMusicPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<T?> invokeMethod<T>(String method, [arguments]) {
    throw UnimplementedError();
  }

  @override
  void setOnFftDataListener(OnFftDataListener listener) {
  }

  @override
  void setOnMusicCallback(OnMusicCallback callback) {
  }
}

void main() {
  final LibMusicPlatform initialPlatform = LibMusicPlatform.instance;

  test('$MethodChannelLibMusic is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelLibMusic>());
  });

  test('getPlatformVersion', () async {
    LibMusic libMusicPlugin = LibMusic.instance;
    MockLibMusicPlatform fakePlatform = MockLibMusicPlatform();
    LibMusicPlatform.instance = fakePlatform;

    expect(await libMusicPlugin.getPlatformVersion(), '42');
  });
}
